package com.css.zfzx.sjcj.modules.hddcSamplePoint.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcSamplePoint.viewobjects.HddcSamplepointVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FieldSamplePointManaExcelVerifyHandler implements IExcelVerifyHandler<HddcSamplepointVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public FieldSamplePointManaExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcSamplepointVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getExtends5())) {
            helper.writeNotNullMsg(result, "经度");
        } else if (PlatformObjectUtils.isEmpty(vo.getExtends6())) {
            helper.writeNotNullMsg(result, "纬度");
        } else if (PlatformObjectUtils.isEmpty(vo.getTown())) {
            helper.writeNotNullMsg(result, "详细地址");
        } else if (PlatformObjectUtils.isEmpty(vo.getFieldid())) {
            helper.writeNotNullMsg(result, "野外编号");
        } else if (PlatformObjectUtils.isEmpty(vo.getSamplesource())) {
            helper.writeNotNullMsg(result, "数据来源");
        }
        return result;
    }

}
